import request from '@/utils/request'

/**
 * 查询
 * @param {Object} params
 */
export function dataApi(params) {
  return request({
    url: '/api/employee/data',
    method: 'get',
    params
  })
}


/**新增数据
 * @param {Object} data
 */
export function addApi(data){
  return request({
    url: '/api/employee',
    method: 'post',
    data
  })
}

/**修改数据
 * @param {Object} data
 */
export function updateApi(data){

  let serverUrl='/api/employee'
  if(data.loginPwd){
    serverUrl='/api/employee/update'
  }

  return request({
    url:  serverUrl,
    method: 'put',
    data
  })
}



/**
 * 查询账号是否存在
 * @param {Object} account
 */
export function accountExists(account) {
  return request({
    url: '/api/employee/account/exists/'+account,
    method: 'get'
  })
}

/**
 * 根据主键查询
 * @param {Object} id
 */
export function findByIdApi(id) {
  return request({
    url: '/api/employee/'+id,
    method: 'get'
  })
}


/**
 * 更改账户状态
 * @param {Object} data
 */
export function changeStatusApi(data){
   return request({
     url: '/api/employee/change/status',
     method: 'put',
     data
   })
}
